﻿using System;
using CSharp.Basic.Learn.EventBus;
namespace CSharp.Basic.Learn.发布订阅.委托实现
{
    /// <summary>
    /// 钓鱼的人(观察者)
    /// </summary>
    //public class FishingMan
    //{
    //    public FishingMan(string name)
    //    {
    //        Name = name;
    //    }

    //    public string Name { get; set; }
    //    public int FishCount { get; set; }

    //    public void Update(FishType type)
    //    {
    //        FishCount++;
    //        Console.WriteLine("{0}：钓到一条[{2}]，已经钓到{1}条鱼了！", Name, FishCount, type);
    //    }
    //}

    public class FishingMan : IEventHandler<FishingEventData>
    {
        public FishingMan(string name)
        {
            Name = name;
        }

        public string Name { get; set; }
        public int FishCount { get; set; }

        public void Handle(FishingEventData eventData)
        {
            FishCount++;
            Console.WriteLine("{0}：钓到一条[{2}]，已经钓到{1}条鱼了！", Name, FishCount, eventData.EventTime);
        }
    }
}
